#include "StdAfx.hpp"
#include "PhysxUtils.hpp"


const uint PHYSICS_VISUALIZATION_PARAMS[] = {
	NX_VISUALIZE_WORLD_AXES,
	NX_VISUALIZE_BODY_AXES,
	NX_VISUALIZE_BODY_MASS_AXES,
	NX_VISUALIZE_BODY_LIN_VELOCITY,
	NX_VISUALIZE_BODY_ANG_VELOCITY,
	NX_VISUALIZE_BODY_JOINT_GROUPS,
	NX_VISUALIZE_JOINT_LOCAL_AXES,
	NX_VISUALIZE_JOINT_WORLD_AXES,
	NX_VISUALIZE_JOINT_LIMITS,
	NX_VISUALIZE_CONTACT_POINT,
	NX_VISUALIZE_CONTACT_NORMAL,
	NX_VISUALIZE_CONTACT_ERROR,
	NX_VISUALIZE_CONTACT_FORCE,
	NX_VISUALIZE_ACTOR_AXES,
	NX_VISUALIZE_COLLISION_AABBS,
	NX_VISUALIZE_COLLISION_SHAPES,
	NX_VISUALIZE_COLLISION_AXES,
	NX_VISUALIZE_COLLISION_COMPOUNDS,
	NX_VISUALIZE_COLLISION_VNORMALS,
	NX_VISUALIZE_COLLISION_FNORMALS,
	NX_VISUALIZE_COLLISION_EDGES,
	NX_VISUALIZE_COLLISION_SPHERES,
	NX_VISUALIZE_COLLISION_STATIC,
	NX_VISUALIZE_COLLISION_DYNAMIC,
	NX_VISUALIZE_COLLISION_FREE,
	NX_VISUALIZE_COLLISION_CCD,
	NX_VISUALIZE_COLLISION_SKELETONS,
	NX_VISUALIZE_FLUID_EMITTERS,
	NX_VISUALIZE_FLUID_POSITION,
	NX_VISUALIZE_FLUID_VELOCITY,
	NX_VISUALIZE_FLUID_KERNEL_RADIUS,
	NX_VISUALIZE_FLUID_BOUNDS,
	NX_VISUALIZE_FLUID_PACKETS,
	NX_VISUALIZE_FLUID_MOTION_LIMIT,
	NX_VISUALIZE_FLUID_DYN_COLLISION,
	NX_VISUALIZE_FLUID_STC_COLLISION,
	NX_VISUALIZE_FLUID_MESH_PACKETS,
	NX_VISUALIZE_FLUID_DRAINS,
	NX_VISUALIZE_FLUID_PACKET_DATA,
	NX_VISUALIZE_CLOTH_MESH,
	NX_VISUALIZE_CLOTH_COLLISIONS,
	NX_VISUALIZE_CLOTH_SELFCOLLISIONS,
	NX_VISUALIZE_CLOTH_WORKPACKETS,
	NX_VISUALIZE_CLOTH_SLEEP,
	NX_VISUALIZE_CLOTH_SLEEP_VERTEX,
	NX_VISUALIZE_CLOTH_TEARABLE_VERTICES,
	NX_VISUALIZE_CLOTH_TEARING,
	NX_VISUALIZE_CLOTH_ATTACHMENT,
	NX_VISUALIZE_CLOTH_VALIDBOUNDS,
	NX_VISUALIZE_SOFTBODY_MESH,
	NX_VISUALIZE_SOFTBODY_COLLISIONS,
	NX_VISUALIZE_SOFTBODY_WORKPACKETS,
	NX_VISUALIZE_SOFTBODY_SLEEP,
	NX_VISUALIZE_SOFTBODY_SLEEP_VERTEX,
	NX_VISUALIZE_SOFTBODY_TEARABLE_VERTICES,
	NX_VISUALIZE_SOFTBODY_TEARING,
	NX_VISUALIZE_SOFTBODY_ATTACHMENT,
	NX_VISUALIZE_SOFTBODY_VALIDBOUNDS,
};

const uint PHYSICS_VISUALIZATION_PARAM_COUNT = _countof(PHYSICS_VISUALIZATION_PARAMS);

const char * const PHYSICS_VISUALIZATION_PARAM_NAMES[] = {
	"WORLD AXES",
	"BODY AXES",
	"BODY MASS AXES",
	"BODY LIN VELOCITY",
	"BODY ANG VELOCITY",
	"BODY JOINT GROUPS",
	"JOINT LOCAL AXES",
	"JOINT WORLD AXES",
	"JOINT LIMITS",
	"CONTACT POINT",
	"CONTACT NORMAL",
	"CONTACT ERROR",
	"CONTACT FORCE",
	"ACTOR AXES",
	"COLLISION AABBS",
	"COLLISION SHAPES",
	"COLLISION AXES",
	"COLLISION COMPOUNDS",
	"COLLISION VNORMALS",
	"COLLISION FNORMALS",
	"COLLISION EDGES",
	"COLLISION SPHERES",
	"COLLISION STATIC",
	"COLLISION DYNAMIC",
	"COLLISION FREE",
	"COLLISION CCD",
	"COLLISION SKELETONS",
	"FLUID EMITTERS",
	"FLUID POSITION",
	"FLUID VELOCITY",
	"FLUID KERNEL RADIUS",
	"FLUID BOUNDS",
	"FLUID PACKETS",
	"FLUID MOTION LIMIT",
	"FLUID DYN COLLISION",
	"FLUID STC COLLISION",
	"FLUID MESH PACKETS",
	"FLUID DRAINS",
	"FLUID PACKET DATA",
	"CLOTH MESH",
	"CLOTH COLLISIONS",
	"CLOTH SELFCOLLISIONS",
	"CLOTH WORKPACKETS",
	"CLOTH SLEEP",
	"CLOTH SLEEP VERTEX",
	"CLOTH TEARABLE VERTICES",
	"CLOTH TEARING",
	"CLOTH ATTACHMENT",
	"CLOTH VALIDBOUNDS",
	"SOFTBODY MESH",
	"SOFTBODY COLLISIONS",
	"SOFTBODY WORKPACKETS",
	"SOFTBODY SLEEP",
	"SOFTBODY SLEEP VERTEX",
	"SOFTBODY TEARABLE VERTICES",
	"SOFTBODY TEARING",
	"SOFTBODY ATTACHMENT",
	"SOFTBODY VALIDBOUNDS",
	NULL
};


//HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
// class NxToLogOutputStream

NxToLogOutputStream g_NxLogger;

void NxToLogOutputStream::reportError(NxErrorCode code, const char *message, const char *file, int line)
{
	LOG(LOG_PHYSICS | LOG_ERROR, Format("# (#,#)") % message % file % line);
}

NxAssertResponse NxToLogOutputStream::reportAssertViolation(const char *message, const char *file, int line)
{
	LOG(LOG_PHYSICS | LOG_ERROR, Format("Assert Violation: # (#,#)") % message % file % line);
	return NX_AR_IGNORE;
}

void NxToLogOutputStream::print(const char *message)
{
	LOG(LOG_PHYSICS, message);
}
